﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'roleUpdate')
	BEGIN
		DROP  Procedure  roleUpdate
	END
GO

CREATE PROCEDURE [dbo].[roleUpdate] 
	-- Add the parameters for the stored procedure here
	@role_name VARCHAR(50), 
	@role_desc VARCHAR(255),
	@role_id INT
AS
BEGIN
	SET NOCOUNT ON;

	-- Insert statements for procedure here
	IF (EXISTS(	SELECT * 
					FROM lit_rol
					WHERE lit_rol_id = @role_id)) 
	BEGIN
		UPDATE lit_rol
		SET lit_rol_nombre = @role_name,
			lit_rol_desc = @role_desc
		WHERE lit_rol_id = @role_id;
		SELECT 1;
	END
	ELSE SELECT 0;
END
GO